
/*
* Modal.alert('提示','确定删除所选房源？',
                                    [
                                        {
                                            text:'取消',onPress:()=>{

                                            }
                                        },{
                                        text:'确定',onPress:()=>{
                                            deleteClick()
                                        }}
                                    ]
* */
class AppModal {


    static tipDialog = null
    static alertModal = null
    static helpModal = null


    static setTipRef(ref){
        AppModal.tipDialog = ref
    }
    static setModalRef(ref){
        AppModal.alertModal = ref
    }
    static setHelpRef(ref){
        AppModal.helpModal = ref
    }

    static alert(title,content,actions){
        const {alertModal} = AppModal
        if(!alertModal) return
        alertModal.alert(title,content,actions)
    }

    static hideAlert(){
        const {alertModal} = AppModal
        if(!alertModal) return
        alertModal.hideDialog()
    }

    static showLoading(){

        const {tipDialog} = AppModal
        if(!tipDialog) return

        tipDialog.showLoading()
    }

    static hideTip(){
        const {tipDialog} = AppModal
        if(!tipDialog) return
        tipDialog.hideDialog();
    }



    static showTip(msg){
        const {tipDialog} = AppModal
        if(!tipDialog) return
        tipDialog.showTip(msg);
    }
    static showSuccess = (title)=>{
        const {tipDialog} = AppModal
        if(!tipDialog) return
        tipDialog.showSuccess(title)
    }


    static showError(msg){
        const {tipDialog} = AppModal
        if(!tipDialog) return
        tipDialog.showError( msg);
    }

    static showHelp(){
        const {helpModal} = AppModal
        if(!helpModal) return
        helpModal.show();
    }

}

export default AppModal
